package cn.bgs.service.impl;

import cn.bgs.mapper.ComplainMapper;
import cn.bgs.page.PageRequest;
import cn.bgs.pojo.CommunityActivities;
import cn.bgs.pojo.Complaints;
import cn.bgs.service.ComplainService;
import cn.bgs.utils.R;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ComplainServiceImpl implements ComplainService {
    @Autowired
    private ComplainMapper complainMapper;

    @Override
    public PageInfo<Complaints> complainSelect(PageRequest pageRequest, Integer complaintsTypeId) {
        PageHelper.startPage(pageRequest.getPageNum(),pageRequest.getPageSize());
        PageInfo<Complaints> userPageInfo = new PageInfo<>(complainMapper.selectAll(complaintsTypeId));
        return userPageInfo;
    }

    @Override
    public R tousuSelect() {
        List<Complaints> i = complainMapper.tousuSelect();
        return R.ok().data("i",i);
    }
}
